// import alias from "@rollup/plugin-alias";
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import babel from "@rollup/plugin-babel";
import glsl from "rollup-plugin-glsl";
import json from "@rollup/plugin-json";

// ! 这个文件中的目录为上一层
export default [
  json(),
  babel({
    presets: ["@babel/typescript"],
    extensions: [".ts"],
    babelHelpers: "bundled",
    exclude: ["node_modules"],
    plugins: [
      // 添加对装饰器的解析
      ["@babel/plugin-proposal-decorators", { legacy: true }],
      ["@babel/plugin-proposal-class-properties", { loose: true }],
      [
        "module-resolver",
        {
          alias: {
            source: "./source"
          }
        }
      ]
    ]
  }),

  glsl({
    // By default, everything gets included
    include: /.*(.glsl|.vs|.fs)$/,
    sourceMap: false,
    compress: false
  }),
  commonjs({
    extensions: [".js", ".ts"]
  }),
  nodeResolve({ extensions: [".js", ".ts"] })
];
